package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.PromotionProductApi;
import com.nbsaas.boot.marketing.data.entity.PromotionProduct;
import com.nbsaas.boot.marketing.api.domain.request.PromotionProductRequest;
import com.nbsaas.boot.marketing.api.domain.response.PromotionProductResponse;
import com.nbsaas.boot.marketing.api.domain.simple.PromotionProductSimple;
import com.nbsaas.boot.marketing.rest.convert.PromotionProductSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.PromotionProductEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.PromotionProductResponseConvert;
import com.nbsaas.boot.marketing.data.repository.PromotionProductRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   活动商品-业务接口实现
*/
@Transactional
@Service
public class PromotionProductResource extends BaseResource<PromotionProduct,PromotionProductResponse, PromotionProductSimple, PromotionProductRequest>  implements PromotionProductApi {

    @Resource
    private PromotionProductRepository promotionProductRepository;

    @Override
    public JpaRepositoryImplementation<PromotionProduct, Serializable> getJpaRepository() {
        return promotionProductRepository;
    }

    @Override
    public Function<PromotionProduct, PromotionProductSimple> getConvertSimple() {
        return new PromotionProductSimpleConvert();
    }

    @Override
    public Function<PromotionProductRequest, PromotionProduct> getConvertForm() {
        return new PromotionProductEntityConvert();
    }

    @Override
    public Function<PromotionProduct, PromotionProductResponse> getConvertResponse() {
        return new PromotionProductResponseConvert();
    }




}


